import 'package:dio/dio.dart';
import 'package:my_app/features/article/domain/article.dart';
import 'package:my_app/features/article/domain/article_repository.dart';

class ArticleApi implements ArticleRepository {
  final Dio dio;
  ArticleApi(this.dio);

  @override
  Future<List<Article>> fetchArticles() async {
    final res = await dio.get('/articles');
    return (res.data as List).map((e) => Article.fromJson(e)).toList();
  }
}
